#ifndef CD_OBJ_POOL_H
#define CD_OBJ_POOL_H

#include "cd_common.h"
#include "cd_object.h"

CD_NAMESPACE_BEGIN

class	c_object;
class	c_entity;

class c_smp_obj_pool{
public:
	c_smp_obj_pool():head(NULL){
	}
	~c_smp_obj_pool();
	c_object*	allocate(c_entity*	ent	=	0,
		s32	lcktype	=	c_object::OBJ_TYPE_NORMAL);
	void		deallocate(c_object*);
private:
	struct	node{
		node*	next;
	};
	node*	head;
};

class c_obj_pool
{
public:
	static	c_object*	allocate(c_entity*	ent	=	0,
	s32	type	=	c_object::OBJ_TYPE_NORMAL);
	static	void		deallocate(c_object*);
protected:
private:
	struct	node{
		node*	next;
	};
	static	volatile	s32	lck;
	static	c_smp_obj_pool	pool;
};

CD_NAMESPACE_END

#endif/*CD_OBJ_POOL_H*/